/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.softace.jdbc.annotations;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This annotation is used over fields or bean properties/attributes that are
 * actually JdbcEntities by themselves.<br>The example usage of this annotation
 * is given below:
 * <pre><code>
 * &#064;JdbcEntity(tableName = "student")
 * public class StudentBean {
 *     &#064;JdbcAttribute(columnName = "s_id", isKeyForMap = true)
 *     int studentId;
 *     &#064;JdbcAttribute(columnName = "s_name")
 *     String studentName;
 *     &#064;JdbcAttributeObject(tableName = "degree", tableClass = DegreeBean.class, keyColumnName = "d_id")
 *     DegreeBean degree;
 * }
 *
 * &#064;JdbcEntity(tableName = "degree")
 * public class DegreeBean {
 *     &#064;JdbcAttribute(columnName = "d_id", isKeyForMap = true)
 *     int degreeId;
 *     &#064;JdbcAttribute(columnName = "d_name")
 *     String degreeTitle;
 * }</code></pre>
 *
 * @see JdbcEntity
 * @see JdbcAttribute
 * @author s1lent_warrior
 */
@Documented
@Target(value = ElementType.FIELD)
@Retention(value = RetentionPolicy.RUNTIME)
public @interface JdbcAttributeObject {

    /**
     * The name of the table that has to be mapped with the annotated class.
     *
     * @return the table name
     */
    public String tableName();

    /**
     * The class of the annotated object that is mapped to the table
     *
     * @return the class of the object
     */
    public Class<?> tableClass();

    /**
     * The (optional) key column name for the designated table.
     *
     * @return the key column name
     */
    public String keyColumnName() default "";
}
